﻿namespace LMT.Hardware
{
    using System;

    /// <summary>
    /// class used for control PC Monitor
    /// </summary>
    public class Monitor
    {
        /// <summary>
        /// Flag to control monitor power signal
        /// </summary>
        internal const int MONITOR_POWER = 0xF170;

        /// <summary>
        /// Monitor signal enum
        /// </summary>
        internal enum MonitorSignal : int
        {
            /// <summary>
            /// Turn on signal
            /// </summary>
            On = -0x00000001,
            /// <summary>
            /// Turn off signal
            /// </summary>
            Off = 0x00000002,
            /// <summary>
            /// Standby signal
            /// </summary>
            Standby = 0x00000001,
        }

        /// <summary>
        /// send system command to turn off monitor
        /// </summary>
        public static void TurnOff()
        {
            Win32.SendMessage((IntPtr)Win32.HWND_BROADCAST, Win32.WM_SYSCOMMAND, MONITOR_POWER, (int)MonitorSignal.Off);
        }

        /// <summary>
        /// send system command to standby monitor
        /// </summary>
        public static void Standby()
        {
            Win32.SendMessage((IntPtr)Win32.HWND_BROADCAST, Win32.WM_SYSCOMMAND, MONITOR_POWER, (int)MonitorSignal.Standby);
        }
    }
}
